<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<button>打开页面</button><button>关闭页面</button>
<script>
    var btn=document.getElementsByTagName("button");
    var bool=null;
    btn[0].onclick=function(){
        bool=window.open("http://www.baidu.com","_blank");
    }
    btn[1].onclick=function(){
       bool.close();
    }
</script>
</body>
</html>